@include('Home.head')

<body>
<style>
    .am-header-default{
        background-color: #CC3436;
    }

</style>
<div class="container" id="app">

    <header data-am-widget="header" class="am-header am-header-default my-header">

        <div class="am-header-left am-header-nav">
            <a  onclick="javascript:history.back(-1);" class="">
                <i class="am-header-icon am-icon-chevron-left"></i>
            </a>
        </div>
        <h1 class="am-header-title">

            <a href="#title-link" class="">修改登录密码</a>

        </h1>
        <!-- <div class="am-header-right am-header-nav">
            <a href="" class="">
                <i class="am-header-icon  am-icon-home"></i>
            </a>
        </div> -->
    </header>
    <div class="cart-panel">
        <form class="am-form">
            用户名：
            <div class="am-form-group am-form-icon">
                <i class="am-icon-user" style="color:#329cd9"></i>
                <input type="text" class="am-form-field  my-radius" disabled v-model="UserInfo.name">
            </div>

            原密码：
            <div class="am-form-group am-form-icon">
                <i class="am-icon-lock" style="color:#329cd9"></i>
                <input type="password" class="am-form-field  my-radius" v-model="UserInfo.password" placeholder="请输入原密码">
            </div>
            新密码：
            <div class="am-form-group am-form-icon">
                <i class="am-icon-lock" style="color:#329cd9"></i>
                <input type="password" class="am-form-field  my-radius" v-model="UserInfo.repassword" placeholder="请输入新密码">
            </div>



            <p class="am-text-center"><button type="button" class="am-btn am-btn-danger am-radius am-btn-block" v-on:click="edit(UserInfo.uid)" style="border: none;border-radius:50px;">立即修改</button></p>

        </form>
    </div>
</div>
</body>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            UserInfo: {
                uid:'',
                password:'',
                repassword:''
            },
        },
        methods: {
            initialize: function () { //查找资料
                $.post("/home/member/editInfo", {'_token': '{{csrf_token()}}','class':'find'}, function (res) {
                    if (res.code) {
                        app.UserInfo = res.data;
                    } else {
                        layer.msg(res.data);
                    }
                });


            },

            //修改登录密码

            edit:function(uid){
                $.post("/home/member/editInfo", {'_token': '{{csrf_token()}}','class':'loginPass',uid:uid,UserInfo:app.UserInfo}, function (res) {
                    if (res.code) {
                        layer.msg(res.data);
                        location.href = "/home/login/login";
                    } else {
                        layer.msg(res.data);
                    }
                });
            }
        },
        //自动执行
        mounted: function () {
            this.initialize();
        },
    })
</script>
</html>










